#ifndef __XGLWindowImpl__h__included__
#define __XGLWindowImpl__h__included__

#include <X11/Xlib.h>
#include <GL/glx.h>
#include <GL/gl.h>

#include "gui/WindowImpl.h"
#include "render/iRenderer.h"

#include <string>
using std::string;

using neiderra::rendering::iRenderer;

namespace neiderra{
	namespace gui {
			
		class XGLWindowImpl: public GUIWindowImpl
		{
			public:
//				XGLWindowImpl(Core*, const string& title, aWindow* container);
				XGLWindowImpl(Core*, const string& title, int x, int y, int w, int h, GUIWindow* container);
				virtual ~XGLWindowImpl();
				
				virtual void swapBuffers();
				
				virtual void setRenderer(iRenderer*);
				
				virtual int ResponseEvent(XEvent&);
				
				//! Returns X window typeof(Window) pointer
				virtual Window GetXID() {return _window;}
				virtual long getID() {return (long) _window; }
				
				unsigned getWidth();
				
				unsigned getHeight();
					
				virtual void show();
				
				virtual void update();	
			private:
				XVisualInfo* _vi;
				Colormap	_cmap;
				XSetWindowAttributes _swa;
				XWindowAttributes _attribs;
				GLXContext	_cx;
				Display* _display;
				Window _window;
				string _title;
				iRenderer* _renderer;
		};
			
	}
}

#endif
